//
//  FDDiseaseKindsController.m
//  FamousDoctorOnline
//
//  Created by Cain on 16/7/7.
//  Copyright © 2016年 wszyxc. All rights reserved.
//

#import "FDDiseaseKindsController.h"

@interface FDDiseaseKindsController ()<UITableViewDataSource,UITableViewDelegate>


@end

@implementation FDDiseaseKindsController




- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupKindView];
}

/**替换成tableView*/
- (void)setupKindView {
    UITableView *kindView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    kindView.dataSource = self;
    kindView.delegate = self;
    [self.view addSubview:kindView];
}

#pragma mark
#pragma mark dataSourseDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.kindArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *const ID = @"kind";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:ID];
    }
    cell.textLabel.text = self.kindArray[indexPath.row];
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(self.kindArray.count > 5)
    {
        _returnBlock(self.kindArray[indexPath.row]);
    }
    else{
        _returnBlock(self.kindArray[indexPath.row]);
    }
    
    [self.navigationController popViewControllerAnimated:YES];
}

@end
